'use strict';

/**
 * @ngdoc filter
 * @name webApp.filter:trustHtml
 * @function
 * @description
 * # trustHtml
 * Filter in the webApp.
 */
//转换为可信html
angular.module('webApp')
  .filter('trustHtml', function ($sce) {
  return function (input) {
    if(typeof input != 'undefined' && input!=''){
      input = input.replace(/[&]/g,"").replace(/：/g,"")
          .replace(/amp;/g,"").replace(/nbsp;/g," ").replace(/#34;/g,"")
          .replace(/ldquo;/g,'"').replace(/rdquo;/g,'"').replace(/mdash;mdash;/g,'——')
          .replace(/sup2;/g,'²').replace(/mdash;/g,'');
      return $sce.trustAsHtml(input);
    }
  }
});
